#ifndef _MEMORYPOOL_
#define _MEMORYPOOL_

#include "Types.hpp"
#include <cstring>

/** 
* Basic memory pool that can only grow or be cleared.
* Allocations can be variably sized.
*/
class MemoryPool{
private:
	/** 
	* Size of memory pool in bytes.
	*/
	unsigned int size;

public:

	/** 
	* Memory pool buffer.
	*/
	byte* pool;

	/** 
	* Previous location of memory pool that has been allocated to.
	*/
	unsigned int lastLocation;

	/** 
	* Current location of memory pool that is free.
	*/
	unsigned int location;

	MemoryPool();

	void createPool(unsigned int s);
	void* allocate(size_t as);
	void clear();
    bool copy(size_t as, void* data);

	~MemoryPool();
};

#endif